﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Zenject;
namespace DiIoc.NonMonoBehaviour
{
    public class UsingCorouting : IInitializable
    {
        AsyncProcessor _asyncProcessor;
        public UsingCorouting(AsyncProcessor asyncProcessor)
        {
            _asyncProcessor = asyncProcessor;
        }
        public void Initialize()
        {
            _asyncProcessor.StartCoroutine(RunAsync());
            
        }

        private IEnumerator RunAsync()
        {
            Debug.Log($"Corouting Started at {DateTime.Now}");
            yield return new WaitForSeconds(2);
            Debug.Log($"Corouting Exited at {DateTime.Now}");
        }
    }
    /// <summary>
    /// so this is just a proxy class to excute coroutings
    /// </summary>
    public class AsyncProcessor : MonoBehaviour { }
}

